﻿@{
    ViewBag.Title = "Index";
}
<link href="~/Content/css/framework-theme.css" rel="stylesheet" />
<link href="~/Content/select2/select2.min.css" rel="stylesheet" />
<script src="~/Content/select2/select2.min.js"></script>
<script charset="utf-8" src="/Content/kindeditor/kindeditor-all-min.js"></script>
<script charset="utf-8" src="/Content/kindeditor/lang/zh-CN.js"></script>
<script type="text/javascript">
    var editor;
    KindEditor.ready(function (K) {
        editor = K.create('#Contents', {
            uploadJson: '/KindEditor/SaveFiles',
            fileManagerJson: '/KindEditor/FileManager',
            allowFileManager: true,
            urlType:"domain"
        });
    });
</script>
@this.RefStyle("~/Content/webuploader/webuploader.css")
@this.RefScript("~/Content/webuploader/webuploader.js")
@Html.Partial("Index_js")
<style type="text/css">
        /*
    .img_thum {max-width:100px;}*/
</style>
<style type="text/css">
    #picker {
        display: inline-block;
        line-height: 10px;
        vertical-align: middle;
        margin: 0 12px 0 0;
    }

    .img_thum {
        width: 100px;
        margin-right: 5px;
    }

    .img_red {
        border: 1px solid #ff6a00;
    }

    #thelist {
        overflow-y: hidden;
        overflow-x: scroll;
    }
</style>
<div style="width:100%;">
    <div class="topPanel">
        <div class="toolbar">
            <a class="a-btn-refresh" onclick="$ace.reload()"></a>
            <button class="a-btn-edit" data-bind="click:edit,disable:!dataTable.selectedModel()">修改</button>
            <button class="a-btn-add" data-bind="click:add">添加</button>

             
            <button class="a-btn-delete" data-bind="click:del,disable:!dataTable.selectedModel()">删除</button>
        </div>
        <div class="search">
            <table class="form-table" style="width:auto;">
                <tr>                    
                    <td style="width:100px;">
                        <select class="a-control" id="SortID" name="SortID" data-bind="options:_sorts,optionsText:'Title',optionsValue:'Id',optionsCaption:'--选择分类--',value:searchModel().SortID">
                            <option value="0">--选择分类--</option>
                        </select>
                    </td>
                    <td>
                        <input type="text" class="a-control" placeholder="请输入要查询关键字" style="width: 200px;" data-bind="value:searchModel().keyword">
                    </td>
                    <td>
                        <button type="button" class="a-btn-search" data-bind="click:search"></button>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div>
        <table class="table table-hover" data-bind="with:dataTable">
            <thead>
                <tr>
                    <th style="width:20px;"></th>
                    <th>产品名称</th>
                    <th>产品编码</th>
                    <th>产品分类</th>
                    <th>规格</th>                    
                    <th>浏览量</th>
                    <th>库存</th>                    
                </tr>
            </thead>
            <tbody data-bind="foreach:models">
                <tr data-bind="click:$parent.selectRow">
                    <td data-bind="text:$parent.getOrdinal($index())"></td>
                    <td data-bind="text:ProductName"></td>
                    <td data-bind="text:ProductCode"></td>
                    <td data-bind="text:$ace.findName(_sorts,ProSortID(),'Id','Title')"></td>
                    <td data-bind="text:ProSize"></td>
                    <td data-bind="text:Hit"></td>
                    <td data-bind="text:Stock"></td>
                </tr>
            </tbody>
            @Html.Partial("_tfoot")
        </table>
    </div>
</div>

<dialogbox data-bind="with:dialog" style="width:80%;">
    <form id="form1">
        <!------------------------------------------------------------------------------------->
        <div class="content-tabs">
            <nav class="page-tabs menuTabs">
                <div class="page-tabs-content" style="margin-left: 0px;">
                    <a href="javascript:;" class="menuTab active">基本信息</a>
                    <a href="javascript:;" class="menuTab">详细内容</a>
                </div>
            </nav>
        </div>
        <!------------------------------------------------------------------------------------->
        <div class="pro_tab">
            <input name="Price" id="Price" type="hidden" class="a-control required" placeholder="请输入一级会员价" data-bind="value:model().Price" />
            <input name="Price2" id="Price2" type="hidden" class="a-control" placeholder="请输入二级会员价" data-bind="value:model().Price2" />
            <input name="Price3" id="Price3" type="hidden" class="a-control" placeholder="请输入三级会员价" data-bind="value:model().Price3" />
            <input name="SharePercent" id="SharePercent" type="hidden" class="a-control required" placeholder="请输入分销比例" data-bind="value:model().SharePercent" />
            <input name="BrandID" id="BrandID" type="hidden" class="a-control required"   data-bind="value:model().BrandID" /> 
            <table class="form-table">
                <tbody>

                    <tr>
                        <td class="form-title">产品名称</td>
                        <td class="form-value"><input name="ProductName" type="text" class="a-control required" placeholder="请输入产品名称" data-bind="value:model().ProductName" /></td>
                        <td class="form-title">产品编码</td>
                        <td class="form-value"><input name="ProductCode" type="text" class="a-control required" placeholder="请输入产品编码" data-bind="value:model().ProductCode" /></td>
                    </tr>
                    <tr>

                        <td class="form-title">产品分类</td>
                        <td class="form-value">
                            <select name="ProSortID" id="ProSortID" type="text" class="a-control required" data-bind="options:_sorts,optionsText:'Title',optionsValue:'Id',optionsCaption:'--选择分类--',value:model().ProSortID"></select>
                        </td>
                        <td class="form-title">库存</td>
                        <td class="form-value">
                            <input name="Stock" id="Stock" type="text" class="a-control" placeholder="请输入库存" data-bind="value:model().Stock" />
                        </td>
                    </tr>

                    <tr>
                        <td class="form-title">规格</td>
                        <td class="form-value">
                            <input name="ProSize" id="ProSize" type="text" class="a-control required" placeholder="请输入规格" data-bind="value:model().ProSize" />
                        </td>
                        <td class="form-title">浏览量</td>
                        <td class="form-value">
                            <input name="Hit" type="text" class="a-control required" placeholder="" data-bind="value:model().Hit" />
                        </td>
                    </tr>

                    <tr>
                        <td class="form-title">下单周期起始</td>
                        <td class="form-value">
                            <select name="Date1" id="Date1" type="text" class="a-control required" data-bind="options:_mss,optionsText:'text',optionsValue:'id',optionsCaption:'--选择--',value:model().Date1"></select>
                        </td>
                        <td class="form-title">下单周期结束</td>
                        <td class="form-value">
                            <select name="Date2" id="Date2" type="text" class="a-control required" data-bind="options:_mss,optionsText:'text',optionsValue:'id',optionsCaption:'--选择--',value:model().Date2"></select>
                        </td>
                    </tr>
                </tbody>
            </table>
            <table class="form-table">
                <tbody>
                    <tr>
                        <td class="form-title">简介</td>
                        <td class="form-value">
                            <input name="Summary" id="Summary" type="text" class="a-control required" placeholder="请输入简介" data-bind="value:model().Summary" />
                        </td>
                    </tr>
                    <tr>
                        <td class="form-title">图片</td>
                        <td class="form-value">
                            <div id="uploader" class="wu-example" style="z-index:99999;">
                                <div class="btns">
                                    <div id="picker">选择文件</div>
                                </div>
                                <div id="thelist" class="uploader-list"></div>
                            </div>
                        </td>
                    </tr>
                    <tr style="display:none">
                        <td></td>
                        <td><input name="ImageUrl" id="ImageUrl" type="text" class="a-control required" data-bind="value:model().ImageUrl" /></td>
                    </tr>
                    <tr style="display:none">
                        <td></td>
                        <td><input id="ImageList" name="ImageList" type="text" class="a-control required" data-bind="value:model().ImageList" /></td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="pro_tab" style="display:none;">
            <textarea id="Contents" name="Contents" style="width:100%;height:300px;" data-bind="value:model().Contents">
            </textarea>
        </div>
    </form>
</dialogbox>

<script type="text/javascript">
    jQuery(function () {
        jQuery(".menuTab").click(function () {
            var i = jQuery(this).index();

            jQuery(".menuTab").removeClass("active");
            jQuery(this).addClass("active");

            jQuery(".pro_tab").hide();
            jQuery(".pro_tab").eq(i).show();
        });
    });
    
</script>
